p  =  {6,  28,  496,  8128,  33550336}
p
type(p)


#The set constructor
d = {}
type(d)

e = set()
e

s  =  set([2,  4,  16,  64,  4096,  65536,  262144])
s

t  =  [1,  4,  2,  1,  7,  9,  9]
set(t)


#Iterating over sets
for x  in {1,  2,  4,  8,  16,  32}:
    print(x)


#Membership testing of sets
q  =  {  2,  9,  6,  4  }
3 in q
3 not in q


#Adding elements to sets
k  =  {81,  108}
k
k.add(54)
k
k.add(12)
k

k.add(108)
k

k.update([37,  128,  97])
k


#Removing elements from sets
k.remove(97)
k

k.remove(98)

k.discard(98)
k


#Copying sets
j = k.copy()
j

m = set(j)
m


#Set algebra operations
blue_eyes  =  {'Olivia',  'Harry',  'Lily',  'Jack',  'Amelia'}
blond_hair  =  {'Harry',  'Jack',  'Amelia',  'Mia',  'Joshua'}
smell_hcn  =  {'Harry',  'Amelia'}
taste_ptc  =  {'Harry',  'Lily',  'Amelia',  'Lola'}
o_blood  =  {'Mia',  'Joshua',  'Lily',  'Olivia'}
b_blood  =  {'Amelia',  'Jack'}
a_blood  =  {'Harry'}
ab_blood  =  {'Joshua',  'Lola'}

#Union
blue_eyes.union(blond_hair)
blue_eyes.union(blond_hair)  ==   blond_hair.union(blue_eyes)

#Intersection
blue_eyes.intersection(blond_hair)
blue_eyes.intersection(blond_hair)  ==  blond_hair.intersection(blue_eyes)

#Difference
blond_hair.difference(blue_eyes)
blond_hair.difference(blue_eyes) == blue_eyes.difference(blond_hair)

#Symmetric difference
blond_hair.symmetric_difference(blue_eyes)
blond_hair.symmetric_difference(blue_eyes) == blue_eyes.symmetric_difference(blond_hair)


#Set relationships.
smell_hcn.issubset(blond_hair)
taste_ptc.issuperset(smell_hcn)
a_blood.isdisjoint(o_blood)
